﻿<%@ Page Title="" Language="C#" MasterPageFile="~/manager/page/ManagerMasterPage.Master" AutoEventWireup="true" CodeBehind="card.aspx.cs" Inherits="Com.Web.coffinegurunaru.manager.usercard.card" %>
<%@ Register TagPrefix="UC" TagName="Menu" Src="~/manager/usercard/menu.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="phHead" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="phContent" runat="server">


<hr />
<br />
<table width="100%" border="0">
<tr>
	<td valign="top" width="60">
<UC:Menu ID="Menu1" SubPageType=1 runat="server" />
	</td>
	<td style="width:20px;"></td>
	<td valign="top">
		<table cellpadding="3" cellspacing="1" style="background-color:Gray; width:100%;">
		<tr>
			<td style="background-color:Silver; text-align:center; height:30px; width:100px; text-align:center;">카드검색</td>
			<td style="background-color:White; text-align:center; text-align:left;">
				<select id="m_Status">
					<option value="1">등록</option>
					<option value="3">삭제</option>
				</select>
			</td>
		</tr>
		<tr>
			<td style="background-color:Silver; text-align:center; height:30px; text-align:center;">카드번호</td>
			<td style="background-color:White; text-align:center; text-align:left;">
				<input type="text" id="m_CardNo" />
			</td>
		</tr>
		<tr>
			<td style="background-color:Silver; text-align:center; height:30px; text-align:center;">유저</td>
			<td style="background-color:White; text-align:center; text-align:left;">
				<input type="text" id="m_UserID" />
			</td>
		</tr>
		<tr>
			<td style="background-color:White; text-align:center; text-align:center;" colspan="2">
				<input type="button" id="m_btnSearch" value="검색" />
			</td>
		</tr>
		</table>
		<br />
		<table width="100%">
		<tr>
			<td style="text-align:center;">
				<div id="m_CardList"></div>
				<br />
				<div id="m_Pager"></div>			
			</td>
		</tr>
		</table>
	</td>
</tr>
</table>
<div id="m_Layer" style="position:absolute; top:400px; left:400px; width:400px; height: 200px; display:none; ">
<table border="0" cellpadding="5" cellspacing="1" width="100%" style="background-color:Green;"><tr><td>
<table cellpadding="2" cellspacing="1" style="background-color:Gray; width:100%;" id="m_tblCardInfo">
<tr>
	<td style="background-color:Silver; text-align:center; height:30px; width:100px; text-align:center;">등록번호</td>
	<td style="background-color:White; text-align:center; text-align:left;" class="m_UserCardNo"></td>
</tr>
<tr>
	<td style="background-color:Silver; text-align:center; height:30px; width:100px; text-align:center;">카드번호</td>
	<td style="background-color:White; text-align:center; text-align:left;" class="m_CardNo"></td>
</tr>
<tr>
	<td style="background-color:Silver; text-align:center; height:30px; width:100px; text-align:center;">회원아이디</td>
	<td style="background-color:White; text-align:center; text-align:left;" class="m_UserID"></td>
</tr>
<tr>
	<td style="background-color:Silver; text-align:center; height:30px; width:100px; text-align:center;">내용</td>
	<td style="background-color:White; text-align:center; text-align:left;"><input type="text" class="m_Desc" style="width:250px" /></td>
</tr>
<tr>
	<td style="background-color:White; text-align:center; text-align:center;" colspan="2"><input type="button" class="m_RemoveConfirm" value="삭제" />&nbsp;&nbsp;&nbsp;<input type="button" class="m_RemoveCancel" value="취소" /></td>
</tr>
</table>
</td></tr></table>
</div>
<script language="javascript" type="text/javascript">
(function($) {
	$.UserCard = {
		Init : function() {
			$("#m_Pager").pager({
				pageSize : 20,
				useCallback : true,
				pageNo : 1,
				callback:function(pageNo) {
					$.UserCard.GetList();
				}
			});
			
			$("#m_btnSearch").click(function() {
				$("#m_Pager").pager("option", "currentPageNo", 1)
				$.UserCard.GetList();
				return false;
			});
			
			$("#m_Layer input.m_RemoveCancel").click(function() {
				$("#m_Layer #m_tblCardInfo td.m_UserCardNo").text("");
				$("#m_Layer #m_tblCardInfo td.m_CardNo").text("");
				$("#m_Layer #m_tblCardInfo td.m_UserID").text("");
				$("#m_Layer #m_tblCardInfo input.m_Desc").val("");
				$("#m_Layer").hide();
			});
			
			$("#m_Layer input.m_RemoveConfirm").click(function() {
				var UserCardNo = $("#m_Layer #m_tblCardInfo td.m_UserCardNo").text();
				var Desc = $("#m_Layer #m_tblCardInfo input.m_Desc").val();
				$("#m_CardList").ajaxNet(
				"/manager/usercard/usercardmethod.aspx?_vb=Remove",
				{
					"UserCardNo" : UserCardNo
				,	"Desc" : Desc
				}, function(results, context)
				{
					alert("삭제하였습니다.");
					$("#m_Layer #m_tblCardInfo td.m_UserCardNo").text("");
					$("#m_Layer #m_tblCardInfo td.m_CardNo").text("");
					$("#m_Layer #m_tblCardInfo td.m_UserID").text("");
					$("#m_Layer #m_tblCardInfo input.m_Desc").val("");
					$("#m_Layer").hide();
					$.UserCard.GetList();
				});

				$("#m_Layer").hide();
			});
			
			$.UserCard.GetList();
		},
		
		GetList : function() {
			var CodeStatus = $("#m_Status").val();
			var CardNo = $("#m_CardNo").val();
			var UserID = $("#m_UserID").val();
			$("#m_CardList").ajaxNet(
			"/manager/usercard/usercardmethod.aspx?_vb=GetList",
			{
				"CodeStatus" : CodeStatus
			,	"CardNo" : CardNo
			,	"UserID" : UserID
			,	"PageNo" : $("#m_Pager").pager("option", "currentPageNo")
			,	"PageSize" : $("#m_Pager").pager("option", "pageSize")
			}, function(results, context)
			{
				if ( results[2] == "" )
				{
					$("#m_CardList").html( results[ 0 ] );
					$("#m_Pager").pager("update", results[1]);
					
					$("#m_CardList input.m_CardRemove").click(function() {
						var $tr = $(this).closest("tr");
						$("#m_Layer").show();
						$("#m_Layer #m_tblCardInfo td.m_UserCardNo").text($tr.find("td.m_UserCardNo").text());
						$("#m_Layer #m_tblCardInfo td.m_CardNo").text($tr.find("td.m_CardNo").text());
						$("#m_Layer #m_tblCardInfo td.m_UserID").text($tr.find("td.m_UserID").text());
						$("#m_Layer #m_tblCardInfo input.m_Desc").focus();
					});
					
					$("#m_CardList input.d_CardRestore").click(function() {
						var $tr = $(this).closest("tr");
						
						if ( confirm("정말로 복수 하시겠습니까?") ) {
							var UserCardNo = $tr.find("td.m_UserCardNo").text();
							$("#m_CardList").ajaxNet(
							"/manager/usercard/usercardmethod.aspx?_vb=Restore",
							{
								"UserCardNo" : UserCardNo
							}, function(results, context)
							{
								alert("복구하였습니다.");
								$.UserCard.GetList();
							});
						}
					});
				}
				else
				{
					alert( results[2] );
				}
			});
		}
	}
	
	$(function() {
		$.UserCard.Init();
	});
})(jQuery);
</script>

</asp:Content>
